import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'IPTVOPlatform.settings')
django.setup()
from oplatform.models import ConfigurationData
all_configurations = [
    {'id': 1, 'name': '通道一'},
    {'id': 2, 'name': '通道二'},
    {'id': 3, 'name': '通道三'},
    {'id': 4, 'name': '通道四'},
    {'id': 5, 'name': '通道五'},
    {'id': 6, 'name': '通道六'},
    {'id': 7, 'name': '通道七'},
    {'id': 8, 'name': '通道八'},
]

def clean_configurations():
    ConfigurationData.objects.all().delete()


def create_configurations():
    for item in all_configurations:
        ConfigurationData.objects.create(**item)


def run():
    clean_configurations()
    create_configurations()


run()
